const viewMoreEle = document.querySelector(' .link-login')
viewMoreEle && viewMoreEle.addEventListener('click', () => {
    toLogin()
})
function getList(wrap,url, listFn, loadedFn) {
    _axios.get(url).then(res => {
        if(res.Code === 200) {
            const list = res.Data.list
            let str = ''
            if(gugeeGobal.isMobile) {
                const rorate = document.querySelector('.gd-mobile-list__footer .rotate')
                const footerText = document.querySelector('.gd-mobile-list__footer .list-footer-tx')
                if(res.Data.totalRow === 0) {
                    wrap.innerHTML = ''
                    showNoDataImg(wrap)
                    rorate && rorate.hide()
                    footerText && footerText.hide()
                    hasData = false
                    if(!gugeeGobal.isLogin) {
                        document.querySelector('.gd-mobile-list__footer').hide()
                    }
                    wrap.removeAttribute('style')
                } else {
                    if(!gugeeGobal.isLogin) {
                        document.querySelector('.gd-mobile-list__footer').show()
                    }
                    if(res.Data.lastPage) {
                        hasData = false
                        rorate && rorate.hide()
                        footerText && (() => {
                            footerText.innerHTML = 'You have reached the end.'
                            footerText.show()
                        })()
                        wrap.style.minHeight = 'auto'
                    } else {
                        hasData = true
                        rorate && rorate.show()
                        footerText && footerText.hide()
                    }
                    str += listFn(list)

                    if(params.page === 1) {
                        wrap.innerHTML = str
                    } else {
                        wrap.innerHTML = wrap.innerHTML + str
                    }
                    loadedFn && loadedFn()
                }
            } else {
                if(params.page === 1) {
                    totalRow = res.Data.totalRow
                    initPagination()
                }
                if(res.Data.totalRow === 0) {
                    showNoDataImg(wrap, {
                        isTable: true
                    })
                } else {
                    wrap.innerHTML = listFn(list)
                    loadedFn && loadedFn()
                    initPopover()
                    /*if(!gugeeGobal.isLogin || (gugeeGobal.isLogin && gugeeGobal.roleId < 3)) {
                        document.querySelectorAll('.td-audience').forEach(item => {
                            showLock(item, {
                                roleId: 3
                            })
                        })
                    }*/
                }
            }
        } else if(res.Code === 403) {
            if(gugeeGobal.isMobile) {
                const rorate = document.querySelector('.gd-mobile-list__footer .rotate')
                const footerText = document.querySelector('.gd-mobile-list__footer .list-footer-tx')
                rorate.hide()
                footerText.innerHTML = res.Msg
                footerText.show()
                hasData = false

                const upgradeEle = document.querySelector('.list-footer-tx .text-link')
                upgradeEle.addEventListener('click', () => {
                    window.location.href = '/pricing?refer=' + window.location.href
                })
            }
        }
        wrap.hideLoading()
    })
}
